<template>
  <div>
    <div class="banner" @click="handleBannerClick">
      <img :src="bannerImg" class="banner-img" />
      <div class="banner-info">
        <div class="banner-title">
          {{sightName}}
        </div>
        <div class="banner-num">
          <span class="iconfont banner-icon">&#xe66b;</span>
          {{this.bannerImgs.length }}
        </div>
      </div>
    </div>
    <fade-animation>
      <common-gallary
        :imgs="bannerImgs"
        v-show="showGallary"
        @close="handleGallaryClose"
      ></common-gallary>
    </fade-animation>
  </div>
</template>

<script>
import CommonGallary from 'common/gallary/Gallary'
import FadeAnimation from 'common/fade/Fade'
export default {
  name: 'DetailBanner',
  props: {
    sightName: String,
    bannerImg: String,
    bannerImgs: Array
  },
  data: function () {
    return {
      showGallary: false,
      imgs: [
        'http://img1.qunarzz.com/sight/p0/1907/e4/e4a734b0c3fb9598a3.img.jpg_r_800x800_ddb72294.jpg',
        'http://img1.qunarzz.com/sight/p0/1907/ca/ca68bd95bc36bdba3.img.jpg_r_800x800_33169c4b.jpg',
        'http://img1.qunarzz.com/wugc/p123/201211/19/a2045d091f02b25493835fbb.png_r_800x800_c59f0eba.png']
    }
  },
  methods: {
    handleBannerClick: function () {
      this.showGallary = true
    },
    handleGallaryClose: function () {
      this.showGallary = false
    }
  },
  components: {
    CommonGallary,
    FadeAnimation
  },
  comments: {
    CommonGallary
  }
}
</script>

<style lang="stylus" scoped>
.banner
  position: relative
  overflow: hidden
  height:0
  padding-bottom:55%
  .banner-img
    width:100%
  .banner-info
    display: flex
    position: absolute
    left:0
    right:0
    bottom:0
    line-height:.6rem
    color: #fff
    background-image: linear-gradient(top,rgba(0,0,0,0),rgba(0,0,0,.7))
    .banner-title
      font-size: .32rem
      flex:1
      padding:0 .2rem
    .banner-num
      height: .32rem
      line-height:.32rem
      border-radius: .2rem
      background: rgba(0,0,0,.7)
      font-size:.24rem
      margin-top: .14rem
      padding:0 .4rem
      .banner-icon
        font-size:.24rem
</style>
